package model

import (
	"database/sql"
	"github.com/gomodule/redigo/redis"
	"strconv"
	"time"
	"tizhi_front/nspel"
)

type Score struct {
	Id                              int64           `gorm:"AUTO_INCREMENT;primary_key;column:id"`
	CountryId                       int64           `gorm:"column:country_id"`
	ProvinceId                      int64           `gorm:"column:province_id"`
	CityId                          int64           `gorm:"column:city_id"`
	AreaId                          int64           `gorm:"column:area_id"`
	ExperimentAreaId                int64           `gorm:"column:experiment_area_id"`
	SchoolId                        int64           `gorm:"column:school_id"`
	StudentId                       int64           `gorm:"column:student_id"`
	SchoolRollId                    string          `gorm:"column:school_roll_id"`
	Grade                           string          `gorm:"column:grade"`
	Class                           string          `gorm:"column:class"`
	Nation                          string          `gorm:"column:nation"`
	Sex                             byte            `gorm:"column:sex"`
	Height                          sql.NullFloat64 `gorm:"column:height"`
	Weight                          sql.NullFloat64 `gorm:"column:weight"`
	BodyMassIndex                   sql.NullFloat64 `gorm:"column:body_mass_index"`
	BodyMassIndexBasicScore         sql.NullFloat64 `gorm:"column:body_mass_index_basic_score"`
	BodyMassIndexExtraScore         sql.NullFloat64 `gorm:"column:body_mass_index_extra_score"`
	BodyMassIndexTotalScore         sql.NullFloat64 `gorm:"column:body_mass_index_total_score"`
	BodyMassIndexLevel              sql.NullString  `gorm:"column:body_mass_index_level"`
	VitalCapacity                   sql.NullFloat64 `gorm:"column:vital_capacity"`
	VitalCapacityBasicScore         sql.NullFloat64 `gorm:"column:vital_capacity_basic_score"`
	VitalCapacityExtraScore         sql.NullFloat64 `gorm:"column:vital_capacity_extra_score"`
	VitalCapacityTotalScore         sql.NullFloat64 `gorm:"column:vital_capacity_total_score"`
	VitalCapacityLevel              sql.NullString  `gorm:"column:vital_capacity_level"`
	FiftyMeters                     sql.NullFloat64 `gorm:"column:50_meters"`
	FiftyMetersBasicScore           sql.NullFloat64 `gorm:"column:50_meters_basic_score"`
	FiftyMetersExtraScore           sql.NullFloat64 `gorm:"column:50_meters_extra_score"`
	FiftyMetersTotalScore           sql.NullFloat64 `gorm:"column:50_meters_total_score"`
	FiftyMetersLevel                sql.NullString  `gorm:"column:50_meters_level"`
	SitAndReach                     sql.NullFloat64 `gorm:"column:sit_and_reach"`
	SitAndReachBasicScore           sql.NullFloat64 `gorm:"column:sit_and_reach_basic_score"`
	SitAndReachExtraScore           sql.NullFloat64 `gorm:"column:sit_and_reach_extra_score"`
	SitAndReachTotalScore           sql.NullFloat64 `gorm:"column:sit_and_reach_total_score"`
	SitAndReachLevel                sql.NullString  `gorm:"column:sit_and_reach_level"`
	OneMinuteRopeSkipping           sql.NullFloat64 `gorm:"column:1_minute_rope_skipping"`
	OneMinuteRopeSkippingBasicScore sql.NullFloat64 `gorm:"column:1_minute_rope_skipping_basic_score"`
	OneMinuteRopeSkippingExtraScore sql.NullFloat64 `gorm:"column:1_minute_rope_skipping_extra_score"`
	OneMinuteRopeSkippingTotalScore sql.NullFloat64 `gorm:"column:1_minute_rope_skipping_total_score"`
	OneMinuteRopeSkippingLevel      sql.NullString  `gorm:"column:1_minute_rope_skipping_level"`
	OneMinuteSitUp                  sql.NullFloat64 `gorm:"column:1_minute_sit_up"`
	OneMinuteSitUpBasicScore        sql.NullFloat64 `gorm:"column:1_minute_sit_up_basic_score"`
	OneMinuteSitUpExtraScore        sql.NullFloat64 `gorm:"column:1_minute_sit_up_extra_score"`
	OneMinuteSitUpTotalScore        sql.NullFloat64 `gorm:"column:1_minute_sit_up_total_score"`
	OneMinuteSitUpLevel             sql.NullString  `gorm:"column:1_minute_sit_up_level"`
	ShuttleRun                      sql.NullFloat64 `gorm:"column:shuttle_run"`
	ShuttleRunBasicScore            sql.NullFloat64 `gorm:"column:shuttle_run_basic_score"`
	ShuttleRunExtraScore            sql.NullFloat64 `gorm:"column:shuttle_run_extra_score"`
	ShuttleRunTotalScore            sql.NullFloat64 `gorm:"column:shuttle_run_total_score"`
	ShuttleRunLevel                 sql.NullString  `gorm:"column:shuttle_run_level"`
	StandingLongJump                sql.NullFloat64 `gorm:"column:standing_long_jump"`
	StandingLongJumpBasicScore      sql.NullFloat64 `gorm:"column:standing_long_jump_basic_score"`
	StandingLongJumpExtraScore      sql.NullFloat64 `gorm:"column:standing_long_jump_extra_score"`
	StandingLongJumpTotalScore      sql.NullFloat64 `gorm:"column:standing_long_jump_total_score"`
	StandingLongJumpLevel           sql.NullString  `gorm:"column:standing_long_jump_level"`
	Chinning                        sql.NullFloat64 `gorm:"column:chinning"`
	ChinningBasicScore              sql.NullFloat64 `gorm:"column:chinning_basic_score"`
	ChinningExtraScore              sql.NullFloat64 `gorm:"column:chinning_extra_score"`
	ChinningTotalScore              sql.NullFloat64 `gorm:"column:chinning_total_score"`
	ChinningLevel                   sql.NullString  `gorm:"column:chinning_level"`
	OneThousandMeters               sql.NullFloat64 `gorm:"column:1000_meters"`
	OneThousandMetersBasicScore     sql.NullFloat64 `gorm:"column:1000_meters_basic_score"`
	OneThousandMetersExtraScore     sql.NullFloat64 `gorm:"column:1000_meters_extra_score"`
	OneThousandMetersTotalScore     sql.NullFloat64 `gorm:"column:1000_meters_total_score"`
	OneThousandMetersLevel          sql.NullString  `gorm:"column:1000_meters_level"`
	EightHundredMeters              sql.NullFloat64 `gorm:"column:800_meters"`
	EightHundredMetersBasicScore    sql.NullFloat64 `gorm:"column:800_meters_basic_score"`
	EightHundredMetersExtraScore    sql.NullFloat64 `gorm:"column:800_meters_extra_score"`
	EightHundredMetersTotalScore    sql.NullFloat64 `gorm:"column:800_meters_total_score"`
	EightHundredMetersLevel         sql.NullString  `gorm:"column:800_meters_level"`
	PhysicalBasicScore              sql.NullFloat64 `gorm:"column:physical_basic_score"`
	PhysicalExtraScore              sql.NullFloat64 `gorm:"column:physical_extra_score"`
	PhysicalTotalScore              sql.NullFloat64 `gorm:"column:physical_total_score"`
	PhysicalLevel                   sql.NullString  `gorm:"column:physical_level"`
	BodyFat                         sql.NullFloat64 `gorm:"column:body_fat"`
	BodyFatLevel                    sql.NullString  `gorm:"column:body_fat_level"`
	GripStrength                    sql.NullFloat64 `gorm:"column:grip_strength"`
	GripStrengthLevel               sql.NullString  `gorm:"column:grip_strength_level"`
	ResponseCapability              sql.NullFloat64 `gorm:"column:response_capability"`
	ResponseCapabilityLevel         sql.NullString  `gorm:"column:response_capability_level"`
	BalanceAbility                  sql.NullFloat64 `gorm:"column:balance_ability"`
	BalanceAbilityLevel             sql.NullString  `gorm:"column:balance_ability_level"`
	VerticalJump                    sql.NullFloat64 `gorm:"column:vertical_jump"`
	VerticalJumpLevel               sql.NullString  `gorm:"column:vertical_jump_level"`
	Chinese                         sql.NullFloat64 `gorm:"column:chinese"`
	Math                            sql.NullFloat64 `gorm:"column:math"`
	English                         sql.NullFloat64 `gorm:"column:english"`
	Politics                        sql.NullFloat64 `gorm:"column:politics"`
	History                         sql.NullFloat64 `gorm:"column:history"`
	Geography                       sql.NullFloat64 `gorm:"column:geography"`
	Physics                         sql.NullFloat64 `gorm:"column:physics"`
	Chemistry                       sql.NullFloat64 `gorm:"column:chemistry"`
	Biology                         sql.NullFloat64 `gorm:"column:biology"`
	Science                         sql.NullFloat64 `gorm:"column:science"`
	IsExemption                     bool            `gorm:"column:is_exemption"`
	IsSupplementary                 bool            `gorm:"column:is_supplementary"`
	MissingTestNum                  byte            `gorm:"column:missing_test_num"`
	MeasurementDate                 time.Time       `gorm:"column:measurement_date"`
	CreatedAt                       time.Time       `gorm:"column:created_at"`
	UpdatedAt                       time.Time       `gorm:"column:updated_at"`
}

func (*Score) TableName() string {
	return "score"
}

type Score0 struct {
	BodyMassIndexBasicScore         float64 `gorm:"column:body_mass_index_basic_score"`
	BodyMassIndexLevel              string  `gorm:"column:body_mass_index_level"`
	VitalCapacityBasicScore         float64 `gorm:"column:vital_capacity_basic_score"`
	VitalCapacityLevel              string  `gorm:"column:vital_capacity_level"`
	FiftyMetersBasicScore           float64 `gorm:"column:50_meters_basic_score"`
	FiftyMetersLevel                string  `gorm:"column:50_meters_level"`
	SitAndReachBasicScore           float64 `gorm:"column:sit_and_reach_basic_score"`
	SitAndReachLevel                string  `gorm:"column:sit_and_reach_level"`
	OneMinuteRopeSkippingBasicScore float64 `gorm:"column:1_minute_rope_skipping_basic_score"`
	OneMinuteRopeSkippingLevel      string  `gorm:"column:1_minute_rope_skipping_level"`
	PhysicalTotalScore              float64 `gorm:"column:physical_total_score"`
	BodyFatLevel                    string  `gorm:"column:body_fat_level"`
	GripStrengthLevel               string  `gorm:"column:grip_strength_level"`
	ResponseCapabilityLevel         string  `gorm:"column:response_capability_level"`
	BalanceAbilityLevel             string  `gorm:"column:balance_ability_level"`
}

func (*Score0) TableName() string {
	return "score"
}

func (s *Score0) SelectByStudentIdOrderByMeasurementDateDesc(studentId int64) (err error) {
	key := "score0.student_id:" + strconv.FormatInt(studentId, 10) + ".measurement_date.desc.one"
	err = nspel.RedisGetGob(key, s)
	if err == nil {
		return
	}
	if err != redis.ErrNil {
		nspel.Error(err)
	} else {
		err = nil
	}
	if err = nspel.GetOrm().Select([]string{"body_mass_index_basic_score", "body_mass_index_level", "vital_capacity_basic_score", "vital_capacity_level", "50_meters_basic_score", "50_meters_level", "sit_and_reach_basic_score", "sit_and_reach_level", "1_minute_rope_skipping_basic_score", "1_minute_rope_skipping_level", "physical_total_score", "body_fat_level", "grip_strength_level", "response_capability_level", "balance_ability_level"}).Where("student_id = ?", studentId).Order("measurement_date desc").First(s).Error; err != nil {
		return
	}
	nspel.RedisSetGob(key, s)
	return
}

type Score1 struct {
	BodyMassIndexBasicScore float64   `gorm:"column:body_mass_index_basic_score"`
	MeasurementDate         time.Time `gorm:"column:measurement_date"`
}

func (*Score1) TableName() string {
	return "score"
}

type Score2 struct{}

func (*Score2) SelectAllByStudentIdOrderByMeasurementDateAsc(studentId int64) (scores []Score1, err error) {
	key := "score0.student_id:" + strconv.FormatInt(studentId, 10) + ".measurement_date.asc"
	err = nspel.RedisGetGob(key, &scores)
	if err == nil {
		return
	}
	if err != redis.ErrNil {
		nspel.Error(err)
	} else {
		err = nil
	}
	if err = nspel.GetOrm().Select([]string{"body_mass_index_basic_score", "measurement_date"}).Where("student_id = ?", studentId).Order("measurement_date asc").Find(&scores).Error; err != nil {
		return
	}
	nspel.RedisSetGob(key, scores)
	return
}

type Score3 struct {
	BodyMassIndexBasicScore         float64 `gorm:"column:body_mass_index_basic_score"`
	BodyMassIndexLevel              string  `gorm:"column:body_mass_index_level"`
	VitalCapacityBasicScore         float64 `gorm:"column:vital_capacity_basic_score"`
	VitalCapacityLevel              string  `gorm:"column:vital_capacity_level"`
	FiftyMetersBasicScore           float64 `gorm:"column:50_meters_basic_score"`
	FiftyMetersLevel                string  `gorm:"column:50_meters_level"`
	SitAndReachBasicScore           float64 `gorm:"column:sit_and_reach_basic_score"`
	SitAndReachLevel                string  `gorm:"column:sit_and_reach_level"`
	OneMinuteRopeSkippingBasicScore float64 `gorm:"column:1_minute_rope_skipping_basic_score"`
	OneMinuteRopeSkippingLevel      string  `gorm:"column:1_minute_rope_skipping_level"`
	OneMinuteSitUpBasicScore        float64 `gorm:"column:1_minute_sit_up_basic_score"`
	OneMinuteSitUpLevel             string  `gorm:"column:1_minute_sit_up_level"`
	PhysicalTotalScore              float64 `gorm:"column:physical_total_score"`
	BodyFatLevel                    string  `gorm:"column:body_fat_level"`
	GripStrengthLevel               string  `gorm:"column:grip_strength_level"`
	ResponseCapabilityLevel         string  `gorm:"column:response_capability_level"`
	BalanceAbilityLevel             string  `gorm:"column:balance_ability_level"`
	VerticalJumpLevel               string  `gorm:"column:vertical_jump_level"`
}

func (*Score3) TableName() string {
	return "score"
}

func (s *Score3) SelectByStudentIdOrderByMeasurementDateDesc(studentId int64) (err error) {
	key := "score3.student_id:" + strconv.FormatInt(studentId, 10) + ".measurement_date.desc.one"
	err = nspel.RedisGetGob(key, s)
	if err == nil {
		return
	}
	if err != redis.ErrNil {
		nspel.Error(err)
	} else {
		err = nil
	}
	if err = nspel.GetOrm().Select([]string{"body_mass_index_basic_score", "body_mass_index_level", "vital_capacity_basic_score", "vital_capacity_level", "50_meters_basic_score", "50_meters_level", "sit_and_reach_basic_score", "sit_and_reach_level", "1_minute_rope_skipping_basic_score", "1_minute_rope_skipping_level", "1_minute_sit_up_basic_score", "1_minute_sit_up_level", "physical_total_score", "body_fat_level", "grip_strength_level", "response_capability_level", "balance_ability_level", "vertical_jump_level"}).Where("student_id = ?", studentId).Order("measurement_date desc").First(s).Error; err != nil {
		return
	}
	nspel.RedisSetGob(key, s)
	return
}

type Score4 struct {
	BodyMassIndexBasicScore         float64 `gorm:"column:body_mass_index_basic_score"`
	BodyMassIndexLevel              string  `gorm:"column:body_mass_index_level"`
	VitalCapacityBasicScore         float64 `gorm:"column:vital_capacity_basic_score"`
	VitalCapacityLevel              string  `gorm:"column:vital_capacity_level"`
	FiftyMetersBasicScore           float64 `gorm:"column:50_meters_basic_score"`
	FiftyMetersLevel                string  `gorm:"column:50_meters_level"`
	SitAndReachBasicScore           float64 `gorm:"column:sit_and_reach_basic_score"`
	SitAndReachLevel                string  `gorm:"column:sit_and_reach_level"`
	OneMinuteRopeSkippingBasicScore float64 `gorm:"column:1_minute_rope_skipping_basic_score"`
	OneMinuteRopeSkippingLevel      string  `gorm:"column:1_minute_rope_skipping_level"`
	OneMinuteSitUpBasicScore        float64 `gorm:"column:1_minute_sit_up_basic_score"`
	OneMinuteSitUpLevel             string  `gorm:"column:1_minute_sit_up_level"`
	ShuttleRunBasicScore            float64 `gorm:"column:shuttle_run_basic_score"`
	ShuttleRunLevel                 string  `gorm:"column:shuttle_run_level"`
	PhysicalTotalScore              float64 `gorm:"column:physical_total_score"`
	BodyFatLevel                    string  `gorm:"column:body_fat_level"`
	GripStrengthLevel               string  `gorm:"column:grip_strength_level"`
	ResponseCapabilityLevel         string  `gorm:"column:response_capability_level"`
	BalanceAbilityLevel             string  `gorm:"column:balance_ability_level"`
	VerticalJumpLevel               string  `gorm:"column:vertical_jump_level"`
}

func (*Score4) TableName() string {
	return "score"
}

func (s *Score4) SelectByStudentIdOrderByMeasurementDateDesc(studentId int64) (err error) {
	key := "score4.student_id:" + strconv.FormatInt(studentId, 10) + ".measurement_date.desc.one"
	err = nspel.RedisGetGob(key, s)
	if err == nil {
		return
	}
	if err != redis.ErrNil {
		nspel.Error(err)
	} else {
		err = nil
	}
	if err = nspel.GetOrm().Select([]string{"body_mass_index_basic_score", "body_mass_index_level", "vital_capacity_basic_score", "vital_capacity_level", "50_meters_basic_score", "50_meters_level", "sit_and_reach_basic_score", "sit_and_reach_level", "1_minute_rope_skipping_basic_score", "1_minute_rope_skipping_level", "1_minute_sit_up_basic_score", "1_minute_sit_up_level", "shuttle_run_basic_score", "shuttle_run_level", "physical_total_score", "body_fat_level", "grip_strength_level", "response_capability_level", "balance_ability_level", "vertical_jump_level"}).Where("student_id = ?", studentId).Order("measurement_date desc").First(s).Error; err != nil {
		return
	}
	nspel.RedisSetGob(key, s)
	return
}

type Score5 struct {
	BodyMassIndexBasicScore     float64 `gorm:"column:body_mass_index_basic_score"`
	BodyMassIndexLevel          string  `gorm:"column:body_mass_index_level"`
	VitalCapacityBasicScore     float64 `gorm:"column:vital_capacity_basic_score"`
	VitalCapacityLevel          string  `gorm:"column:vital_capacity_level"`
	FiftyMetersBasicScore       float64 `gorm:"column:50_meters_basic_score"`
	FiftyMetersLevel            string  `gorm:"column:50_meters_level"`
	SitAndReachBasicScore       float64 `gorm:"column:sit_and_reach_basic_score"`
	SitAndReachLevel            string  `gorm:"column:sit_and_reach_level"`
	StandingLongJumpBasicScore  float64 `gorm:"column:standing_long_jump_basic_score"`
	StandingLongJumpLevel       string  `gorm:"column:standing_long_jump_level"`
	ChinningBasicScore          float64 `gorm:"column:chinning_basic_score"`
	ChinningLevel               string  `gorm:"column:chinning_level"`
	OneThousandMetersBasicScore float64 `gorm:"column:1000_meters_basic_score"`
	OneThousandMetersLevel      string  `gorm:"column:1000_meters_level"`
	PhysicalTotalScore          float64 `gorm:"column:physical_total_score"`
	BodyFatLevel                string  `gorm:"column:body_fat_level"`
	GripStrengthLevel           string  `gorm:"column:grip_strength_level"`
	ResponseCapabilityLevel     string  `gorm:"column:response_capability_level"`
	BalanceAbilityLevel         string  `gorm:"column:balance_ability_level"`
	VerticalJumpLevel           string  `gorm:"column:vertical_jump_level"`
}

func (*Score5) TableName() string {
	return "score"
}

func (s *Score5) SelectByStudentIdOrderByMeasurementDateDesc(studentId int64) (err error) {
	key := "score5.student_id:" + strconv.FormatInt(studentId, 10) + ".measurement_date.desc.one"
	err = nspel.RedisGetGob(key, s)
	if err == nil {
		return
	}
	if err != redis.ErrNil {
		nspel.Error(err)
	} else {
		err = nil
	}
	if err = nspel.GetOrm().Select([]string{"body_mass_index_basic_score", "body_mass_index_level", "vital_capacity_basic_score", "vital_capacity_level", "50_meters_basic_score", "50_meters_level", "sit_and_reach_basic_score", "sit_and_reach_level", "standing_long_jump_basic_score", "standing_long_jump_level", "chinning_basic_score", "chinning_level", "1000_meters_basic_score", "1000_meters_level", "physical_total_score", "body_fat_level", "grip_strength_level", "response_capability_level", "balance_ability_level", "vertical_jump_level"}).Where("student_id = ?", studentId).Order("measurement_date desc").First(s).Error; err != nil {
		return
	}
	nspel.RedisSetGob(key, s)
	return
}

type Score6 struct {
	BodyMassIndexBasicScore      float64 `gorm:"column:body_mass_index_basic_score"`
	BodyMassIndexLevel           string  `gorm:"column:body_mass_index_level"`
	VitalCapacityBasicScore      float64 `gorm:"column:vital_capacity_basic_score"`
	VitalCapacityLevel           string  `gorm:"column:vital_capacity_level"`
	FiftyMetersBasicScore        float64 `gorm:"column:50_meters_basic_score"`
	FiftyMetersLevel             string  `gorm:"column:50_meters_level"`
	SitAndReachBasicScore        float64 `gorm:"column:sit_and_reach_basic_score"`
	SitAndReachLevel             string  `gorm:"column:sit_and_reach_level"`
	StandingLongJumpBasicScore   float64 `gorm:"column:standing_long_jump_basic_score"`
	StandingLongJumpLevel        string  `gorm:"column:standing_long_jump_level"`
	OneMinuteSitUpBasicScore     float64 `gorm:"column:1_minute_sit_up_basic_score"`
	OneMinuteSitUpLevel          string  `gorm:"column:1_minute_sit_up_level"`
	EightHundredMetersBasicScore float64 `gorm:"column:800_meters_basic_score"`
	EightHundredMetersLevel      string  `gorm:"column:800_meters_level"`
	PhysicalTotalScore           float64 `gorm:"column:physical_total_score"`
	BodyFatLevel                 string  `gorm:"column:body_fat_level"`
	GripStrengthLevel            string  `gorm:"column:grip_strength_level"`
	ResponseCapabilityLevel      string  `gorm:"column:response_capability_level"`
	BalanceAbilityLevel          string  `gorm:"column:balance_ability_level"`
	VerticalJumpLevel            string  `gorm:"column:vertical_jump_level"`
}

func (*Score6) TableName() string {
	return "score"
}

func (s *Score6) SelectByStudentIdOrderByMeasurementDateDesc(studentId int64) (err error) {
	key := "score6.student_id:" + strconv.FormatInt(studentId, 10) + ".measurement_date.desc.one"
	err = nspel.RedisGetGob(key, s)
	if err == nil {
		return
	}
	if err != redis.ErrNil {
		nspel.Error(err)
	} else {
		err = nil
	}
	if err = nspel.GetOrm().Select([]string{"body_mass_index_basic_score", "body_mass_index_level", "vital_capacity_basic_score", "vital_capacity_level", "50_meters_basic_score", "50_meters_level", "sit_and_reach_basic_score", "sit_and_reach_level", "standing_long_jump_basic_score", "standing_long_jump_level", "1_minute_sit_up_basic_score", "1_minute_sit_up_level", "800_meters_basic_score", "800_meters_level", "physical_total_score", "body_fat_level", "grip_strength_level", "response_capability_level", "balance_ability_level", "vertical_jump_level"}).Where("student_id = ?", studentId).Order("measurement_date desc").First(s).Error; err != nil {
		return
	}
	nspel.RedisSetGob(key, s)
	return
}

type Score7 struct {
	BodyMassIndexBasicScore         float64 `gorm:"column:body_mass_index_basic_score"`
	BodyMassIndexLevel              string  `gorm:"column:body_mass_index_level"`
	VitalCapacityBasicScore         float64 `gorm:"column:vital_capacity_basic_score"`
	VitalCapacityLevel              string  `gorm:"column:vital_capacity_level"`
	FiftyMetersBasicScore           float64 `gorm:"column:50_meters_basic_score"`
	FiftyMetersLevel                string  `gorm:"column:50_meters_level"`
	SitAndReachBasicScore           float64 `gorm:"column:sit_and_reach_basic_score"`
	SitAndReachLevel                string  `gorm:"column:sit_and_reach_level"`
	OneMinuteRopeSkippingBasicScore float64 `gorm:"column:1_minute_rope_skipping_basic_score"`
	OneMinuteRopeSkippingLevel      string  `gorm:"column:1_minute_rope_skipping_level"`
}

func (*Score7) TableName() string {
	return "score"
}

func (s *Score7) SelectByStudentIdOrderByMeasurementDataDesc(studentId int64) (err error) {
	key := "score6.student_id:" + strconv.FormatInt(studentId, 10) + ".measurement_date.desc.one"
	err = nspel.RedisGetGob(key, s)
	if err == nil {
		return
	}
	if err != redis.ErrNil {
		nspel.Error(err)
	} else {
		err = nil
	}
	if err = nspel.GetOrm().Select([]string{"body_mass_index_basic_score", "body_mass_index_level", "vital_capacity_basic_score", "vital_capacity_level", "50_meters_basic_score", "50_meters_level", "sit_and_reach_basic_score", "sit_and_reach_level", "1_minute_rope_skipping_basic_score", "1_minute_rope_skipping_level"}).Where("student_id = ?", studentId).Order("measurement_date desc").First(s).Error; err != nil {
		return
	}
	nspel.RedisSetGob(key, s)
	return
}

type Score8 struct {
	BodyMassIndexBasicScore         float64 `gorm:"column:body_mass_index_basic_score"`
	BodyMassIndexLevel              string  `gorm:"column:body_mass_index_level"`
	VitalCapacityBasicScore         float64 `gorm:"column:vital_capacity_basic_score"`
	VitalCapacityLevel              string  `gorm:"column:vital_capacity_level"`
	FiftyMetersBasicScore           float64 `gorm:"column:50_meters_basic_score"`
	FiftyMetersLevel                string  `gorm:"column:50_meters_level"`
	SitAndReachBasicScore           float64 `gorm:"column:sit_and_reach_basic_score"`
	SitAndReachLevel                string  `gorm:"column:sit_and_reach_level"`
	OneMinuteRopeSkippingBasicScore float64 `gorm:"column:1_minute_rope_skipping_basic_score"`
	OneMinuteRopeSkippingLevel      string  `gorm:"column:1_minute_rope_skipping_level"`
	OneMinuteSitUpBasicScore        float64 `gorm:"column:1_minute_sit_up_basic_score"`
	OneMinuteSitUpLevel             string  `gorm:"column:1_minute_sit_up_level"`
}

func (*Score8) TableName() string {
	return "score"
}

func (s *Score8) SelectByStudentIdOrderByMeasurementDateDesc(studentId int64) (err error) {
	key := "score8.student_id:" + strconv.FormatInt(studentId, 10) + ".measurement_date.desc.one"
	err = nspel.RedisGetGob(key, s)
	if err == nil {
		return
	}
	if err != redis.ErrNil {
		nspel.Error(err)
	} else {
		err = nil
	}
	if err = nspel.GetOrm().Select([]string{"body_mass_index_basic_score", "body_mass_index_level", "vital_capacity_basic_score", "vital_capacity_level", "50_meters_basic_score", "50_meters_level", "sit_and_reach_basic_score", "sit_and_reach_level", "1_minute_rope_skipping_basic_score", "1_minute_rope_skipping_level", "1_minute_sit_up_basic_score", "1_minute_sit_up_level"}).Where("student_id = ?", studentId).Order("measurement_date desc").First(s).Error; err != nil {
		return
	}
	nspel.RedisSetGob(key, s)
	return
}

type Score9 struct {
	BodyMassIndexBasicScore         float64 `gorm:"column:body_mass_index_basic_score"`
	BodyMassIndexLevel              string  `gorm:"column:body_mass_index_level"`
	VitalCapacityBasicScore         float64 `gorm:"column:vital_capacity_basic_score"`
	VitalCapacityLevel              string  `gorm:"column:vital_capacity_level"`
	FiftyMetersBasicScore           float64 `gorm:"column:50_meters_basic_score"`
	FiftyMetersLevel                string  `gorm:"column:50_meters_level"`
	SitAndReachBasicScore           float64 `gorm:"column:sit_and_reach_basic_score"`
	SitAndReachLevel                string  `gorm:"column:sit_and_reach_level"`
	OneMinuteRopeSkippingBasicScore float64 `gorm:"column:1_minute_rope_skipping_basic_score"`
	OneMinuteRopeSkippingLevel      string  `gorm:"column:1_minute_rope_skipping_level"`
	OneMinuteSitUpBasicScore        float64 `gorm:"column:1_minute_sit_up_basic_score"`
	OneMinuteSitUpLevel             string  `gorm:"column:1_minute_sit_up_level"`
	ShuttleRunBasicScore            float64 `gorm:"column:shuttle_run_basic_score"`
	ShuttleRunLevel                 string  `gorm:"column:shuttle_run_level"`
}

func (*Score9) TableName() string {
	return "score"
}

func (s *Score9) SelectByStudentIdOrderByMeasurementDateDesc(studentId int64) (err error) {
	key := "score9.student_id:" + strconv.FormatInt(studentId, 10) + ".measurement_date.desc.one"
	err = nspel.RedisGetGob(key, s)
	if err == nil {
		return
	}
	if err != redis.ErrNil {
		nspel.Error(err)
	} else {
		err = nil
	}
	if err = nspel.GetOrm().Select([]string{"body_mass_index_basic_score", "body_mass_index_level", "vital_capacity_basic_score", "vital_capacity_level", "50_meters_basic_score", "50_meters_level", "sit_and_reach_basic_score", "sit_and_reach_level", "1_minute_rope_skipping_basic_score", "1_minute_rope_skipping_level", "1_minute_sit_up_basic_score", "1_minute_sit_up_level", "shuttle_run_basic_score", "shuttle_run_level"}).Where("student_id = ?", studentId).Order("measurement_date desc").First(s).Error; err != nil {
		return
	}
	nspel.RedisSetGob(key, s)
	return
}

type Score10 struct {
	BodyMassIndexBasicScore     float64 `gorm:"column:body_mass_index_basic_score"`
	BodyMassIndexLevel          string  `gorm:"column:body_mass_index_level"`
	VitalCapacityBasicScore     float64 `gorm:"column:vital_capacity_basic_score"`
	VitalCapacityLevel          string  `gorm:"column:vital_capacity_level"`
	FiftyMetersBasicScore       float64 `gorm:"column:50_meters_basic_score"`
	FiftyMetersLevel            string  `gorm:"column:50_meters_level"`
	SitAndReachBasicScore       float64 `gorm:"column:sit_and_reach_basic_score"`
	SitAndReachLevel            string  `gorm:"column:sit_and_reach_level"`
	StandingLongJumpBasicScore  float64 `gorm:"column:standing_long_jump_basic_score"`
	StandingLongJumpLevel       string  `gorm:"column:standing_long_jump_level"`
	ChinningBasicScore          float64 `gorm:"column:chinning_basic_score"`
	ChinningLevel               string  `gorm:"column:chinning_level"`
	OneThousandMetersBasicScore float64 `gorm:"column:1000_meters_basic_score"`
	OneThousandMetersLevel      string  `gorm:"column:1000_meters_level"`
}

func (*Score10) TableName() string {
	return "score"
}

func (s *Score10) SelectByStudentIdOrderByMeasurementDateDesc(studentId int64) (err error) {
	key := "score10.student_id:" + strconv.FormatInt(studentId, 10) + ".measurement_date.desc.one"
	err = nspel.RedisGetGob(key, s)
	if err == nil {
		return
	}
	if err != redis.ErrNil {
		nspel.Error(err)
	} else {
		err = nil
	}
	if err = nspel.GetOrm().Select([]string{"body_mass_index_basic_score", "body_mass_index_level", "vital_capacity_basic_score", "vital_capacity_level", "50_meters_basic_score", "50_meters_level", "sit_and_reach_basic_score", "sit_and_reach_level", "standing_long_jump_basic_score", "standing_long_jump_level", "chinning_basic_score", "chinning_level", "1000_meters_basic_score", "1000_meters_level"}).Where("student_id = ?", studentId).Order("measurement_date desc").First(s).Error; err != nil {
		return
	}
	nspel.RedisSetGob(key, s)
	return
}

type Score11 struct {
	BodyMassIndexBasicScore      float64 `gorm:"column:body_mass_index_basic_score"`
	BodyMassIndexLevel           string  `gorm:"column:body_mass_index_level"`
	VitalCapacityBasicScore      float64 `gorm:"column:vital_capacity_basic_score"`
	VitalCapacityLevel           string  `gorm:"column:vital_capacity_level"`
	FiftyMetersBasicScore        float64 `gorm:"column:50_meters_basic_score"`
	FiftyMetersLevel             string  `gorm:"column:50_meters_level"`
	SitAndReachBasicScore        float64 `gorm:"column:sit_and_reach_basic_score"`
	SitAndReachLevel             string  `gorm:"column:sit_and_reach_level"`
	StandingLongJumpBasicScore   float64 `gorm:"column:standing_long_jump_basic_score"`
	StandingLongJumpLevel        string  `gorm:"column:standing_long_jump_level"`
	OneMinuteSitUpBasicScore     float64 `gorm:"column:1_minute_sit_up_basic_score"`
	OneMinuteSitUpLevel          string  `gorm:"column:1_minute_sit_up_level"`
	EightHundredMetersBasicScore float64 `gorm:"column:800_meters_basic_score"`
	EightHundredMetersLevel      string  `gorm:"column:800_meters_level"`
}

func (*Score11) TableName() string {
	return "score"
}

func (s *Score11) SelectByStudentIdOrderByMeasurementDateDesc(studentId int64) (err error) {
	key := "score11.student_id:" + strconv.FormatInt(studentId, 10) + ".measurement_date.desc.one"
	err = nspel.RedisGetGob(key, s)
	if err == nil {
		return
	}
	if err != redis.ErrNil {
		nspel.Error(err)
	} else {
		err = nil
	}
	if err = nspel.GetOrm().Select([]string{"body_mass_index_basic_score", "body_mass_index_level", "vital_capacity_basic_score", "vital_capacity_level", "50_meters_basic_score", "50_meters_level", "sit_and_reach_basic_score", "sit_and_reach_level", "standing_long_jump_basic_score", "standing_long_jump_level", "1_minute_sit_up_basic_score", "1_minute_sit_up_level", "800_meters_basic_score", "800_meters_level"}).Where("student_id = ?", studentId).Order("measurement_date desc").First(s).Error; err != nil {
		return
	}
	nspel.RedisSetGob(key, s)
	return
}
